<?php
/* @var $this PartyController */
/* @var $model Party */

$this->breadcrumbs=array(
	'[用户]管理'=>array('admin'),
	'修改[用户]',
);
//设置页面标题
$this->pageTitle=Yii::app()->name.' - 修改[用户]';
$this->contentTitle='修改[用户]';
?>
<?php 
    if($type=="clander" || $type=="party"){
        echo ' <button type="button" class="but" onclick="javascript :history.go(-1);">返回</button>';
    }        
?>
<!--表单内容-->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'party-form',
	'enableAjaxValidation'=>false,
        'enableClientValidation'=>true,
        'clientOptions'=>array(
            'validateOnSubmit'=>true
        ),
    'htmlOptions'=>array('class'=>'ajax_form'),
)); ?>
    <style type="text/css">
        .none
        {
            display: none;
        }
        .nTab .TabTitle li
        {
            float: left;
            cursor: pointer;
            width: 100px;
            height: 35px;
            line-height: 35px;
            font-weight: bold;
            text-align: center;
            border: 1px solid #333;
        }
        .nTab .TabTitle li a
        {
            text-decoration: none;
        }
        .nTab .TabTitle .active
        {
            background: #DEDEDE;
        }

    </style>
<table>
	<tr>
		<td>&nbsp;<?php echo $form->labelEx($model,'crowd_id'); ?></td>
		<td>
			<?php echo $form->dropDownList($model,'crowd_id',CHtml::listData(Crowd::model()->findAll(), 'id', 'title'),
                        array('empty'=>'-请选择-')); ?> 
			<?php echo $form->error($model,'crowd_id'); ?>
		</td>
		<td>&nbsp;<?php echo $form->labelEx($model,'username'); ?></td>
		<td>
			<?php echo $form->textField($model,'username',array('size'=>5,'maxlength'=>5,'class'=>'fl input')); ?>
			<?php echo $form->error($model,'username'); ?>
		</td>  
		<td>&nbsp;<?php echo $form->labelEx($model,'sex'); ?></td>
		<td>
                        <?php echo $form->dropDownList($model,'sex',array('男'=>'男','女'=>'女'),
                                    array()); ?> 
			<?php echo $form->error($model,'sex'); ?>
		</td>     
		<td>&nbsp;<?php echo $form->labelEx($model,'phone'); ?></td>
		<td>
			<?php echo $form->textField($model,'phone',array('size'=>11,'maxlength'=>11,'class'=>'fl input')); ?>
			<?php echo $form->error($model,'phone'); ?>
		</td>   
		<td>&nbsp;<?php echo $form->labelEx($model,'company'); ?></td>
		<td>
			<?php echo $form->textField($model,'company',array('size'=>30,'maxlength'=>255,'class'=>'fl input')); ?>
			<?php echo $form->error($model,'company'); ?>
		</td> 
		<td>&nbsp;<?php echo $form->labelEx($model,'code'); ?></td>
		<td>
                    <label id="Party_code">
                        <?php 
                        if(Yii::app()->user->name=='admin')
                            echo $model->code;
                        else 
                             echo Ccommon::truncate_utf8_string ($model->code, 7, "****");
                        ?>
                    </label>

		</td>   
		            
	</tr>
        <tr>
		<td>&nbsp;<?php echo $form->labelEx($model,'recommend'); ?></td>
		<td>
			<?php echo $form->textField($model,'recommend',array('size'=>6,'maxlength'=>20,'class'=>'fl input')); ?>
			<?php echo $form->error($model,'recommend'); ?>
		</td>  
		<td>&nbsp;<?php echo $form->labelEx($model,'province'); ?></td>
                <td style=" text-align: center;">
                    <label id="Party_province">
                    <?php
                    if(empty($model_pn)){
                        echo $model->province; 
                    }  else {
                        echo $model_pn->province; 
                    }
                    ?></label>
		</td> 
		<td>&nbsp;<?php echo $form->labelEx($model,'city'); ?></td>
		<td style=" text-align: center;">
                    <label id="Party_city">
                    <?php
                    if(empty($model_pn)){
                        echo $model->city; 
                    }  else {
                        echo $model_pn->city; 
                    }
                    ?>
                    </label>
		</td> 
		<td>&nbsp;<?php echo $form->labelEx($model,'area'); ?></td>
		<td style=" text-align: center;">
                    <label id="Party_area">
                    <?php
                    if(empty($model_pn)){
                        echo $model->area; 
                    }  else {
                        echo $model_pn->area; 
                    }
                    ?>                        
                    </label>
		</td>  
		<td>&nbsp;<?php echo $form->labelEx($model,'address'); ?></td>
		<td style=" text-align: center;">
                    <label id="Party_address">
                     <?php
                    if(empty($model_pn)){
                        echo $model->address; 
                    }  else {
                        echo $model_pn->address; 
                    }
                    ?>                         
                    </label>
		</td>  
		<td align="right">&nbsp;<?php echo $form->labelEx($model,'head_image'); ?></td>
		<td>
			<?php 
                                $images='';
                                if(!empty($model->head_image))
                                    $images=$model->head_image;
                                else
                                    $images=Yii::app()->baseUrl.'/images/wu.png';
                            ?>
                     <img width="50px" height="50px" src="<?php echo $images?>">
		</td>                
        </tr>
        <tr style="display: none;">
		<td align="right"><?php echo $form->labelEx($model,'children_num'); ?></td>
		<td>
			<?php echo $form->textField($model,'children_num',array('class'=>'fl input')); ?>
			<?php echo $form->error($model,'children_num'); ?>
		</td>           
	</tr>
    </tr>
</table>
<div>
    <input class="but" type="submit" name="yt1" style="float: right; margin-right: 10px;" value="提 交" />  
    <input id="type" name="party_type" style="display: none;" value="<?php echo $type;?>"/>
</div>
<div class="nTab" style=" margin-top: 50px;">
    <div class="TabTitle" style="text-align: center;" >
        <ul id="myTab">
            <li id="li_0" class="active" onclick="nTabs(this,0);">参加活动情况</li>
            <li id="li_1" class="normal" onclick="nTabs(this,1);">消费情况</li>
            <li id="li_2" class="normal" onclick="nTabs(this,2);">携带儿童</li>
            <li id="li_3" class="normal" onclick="nTabs(this,3);">地址管理</li>
            <li id="li_4" class="normal" onclick="nTabs(this,4);">我的推荐</li>

        </ul>
    </div>
    <div class="TabContent">
        <div id="myTab_Content0">
            <iframe frameborder="0"  width=100% height=500px src="<?php echo Yii::app()->createUrl('party/activityMsg',array('phone'=>$model->phone,'code'=>$model->code)) ?>">
            </iframe>
        </div>
        <div id="myTab_Content1" class="none">
            <iframe frameborder="0"  width=100% height=500px src="<?php echo Yii::app()->createUrl('sale/partyMsg',array('party_id'=>$model->id)) ?>">
            </iframe>
        </div>
        <div id="myTab_Content2" class="none">
            <iframe frameborder="0"  width=100% height=500px src="<?php echo Yii::app()->createUrl('children/childrenMsg',array('party_id'=>$model->id)) ?>">
            </iframe>
        </div>
        <div id="myTab_Content3" class="none">
            <iframe frameborder="0"  width=100% height=500px src="<?php echo Yii::app()->createUrl('naddress/create',array('phone'=>$model->phone,'code'=>$model->code)) ?>">
            </iframe>
        </div>
        <div id="myTab_Content4" class="none">
            <iframe frameborder="0"  width=100% height=500px src="<?php echo Yii::app()->createUrl('party/recommendMsg',array('recommend'=>$model->phone)) ?>">
            </iframe>
        </div>        
    </div>
</div>
<script>
        function nTabs(thisObj, Num) {
            if (thisObj.className == "active") return;
            var tabList = document.getElementById("myTab").getElementsByTagName("li");
            for (i = 0; i < tabList.length; i++) {//点击之后，其他tab变成灰色，内容隐藏，只有点击的tab和内容有属性
                if (i == Num) {
                    thisObj.className = "active";
                    document.getElementById("myTab_Content" + i).style.display = "block";
                } else {
                    tabList[i].className = "normal";
                    document.getElementById("myTab_Content" + i).style.display = "none";
                }
            }
        }
        var type=$("#type").val();
        if(type=="clander"){
            $("#li_2").trigger('click');
        }        
</script>
<?php $this->endWidget(); ?>
<!--表单内容-->